<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改折扣权限设定')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-discountPermission-edit" th:object="${basisDiscountPermission}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">用户：</label>
                <div class="col-sm-8">
                    <input name="userId" th:field="*{userId}" class="form-control" type="hidden">
                    <input id="userName" name="userName" th:value="${sysUser.userName}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">最低折扣率：</label>
                <div class="col-sm-8">
                    <input name="minDiscountRate" th:field="*{minDiscountRate}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">最大折让金额：</label>
                <div class="col-sm-8">
                    <input name="maxDiscountPrice" th:field="*{maxDiscountPrice}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "basis/discountPermission";
        $("#form-discountPermission-edit").validate({
            onkeyup: false,
            rules:{
                minDiscountRate:{ number:true,min: 0, max: 1,  },
                maxDiscountPrice:{ number:true },
            },
            messages: {
                "minDiscountRate": { remote: "请输入合法的数字" },
                "maxDiscountPrice": { remote: "请输入整数" },
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-discountPermission-edit').serialize());
            }
        }

    </script>
</body>
</html>